home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / T / Terminal 1.7.cpt / Terminal scripts / Log into CompuServe.s < prev    next >
Text File  |  1989-11-06  |  1KB  |  60 lines

  1. /*
  2.     Terminal 1.7
  3.     "Log into CompuServe.s"
  4. */
  5.  
  6. /* ----- Send command and wait for reply ------------------------------- */
  7.  
  8. check(char *command, char *reply)
  9. {
  10.     type(command);
  11.     return prompt(reply, 1800);    /* Timeout = 30 sec */
  12. }
  13.  
  14. /* ----- Wait for prompt and send command ------------------------------ */
  15.  
  16. answer(char *hint, char *command)
  17. {
  18.     int result;
  19.  
  20.     if (result = prompt(hint, 1800))
  21.         return result;    /* Timeout or cancel */
  22.     pause(60);            /* Don't type immediatly */
  23.     type(command);
  24.     return 0;
  25. }
  26.  
  27. /* ----- Main program -------------------------------------------------- */
  28.  
  29. main()
  30. {
  31.     int go = 1;
  32.  
  33.     while (go) {
  34.         /* Special modem setup (for LUXPAC) */
  35.         if (check("ATS7=60S10=14S9=12\r", "OK"))
  36.             break;
  37.         pause(60);
  38.         /* Dial and log into LUXPAC */
  39.         if (check("ATDP0735\r", "CONNECT"))
  40.             break;
  41.         if (answer("LUXPAC", "N...-03132\r"))
  42.             break;
  43.         /* Now log into CompuServe */
  44.         if (answer("Name", "CIS\r"))
  45.             break;
  46.         if (answer("ID", "73720,2200\r"))
  47.             break;
  48.         if (answer("word", "...\r"))
  49.             break;
  50.         go = 0;            /* Ok */
  51.     }
  52.     if (go) {        /* Timeout or cancel */
  53.         setdtr(0);    /* Negate DTR: modem hangs up */
  54.         pause(60);    /* Wait one second */
  55.         setdtr(1);    /* Assert DTR: now back in command mode */
  56.         beep();        /* 2 beeps if errror */
  57.     }
  58.     beep();
  59. }
  60.